﻿@{
    Layout = null;
}
@using MvcMall.AdminPortal.Controllers.AdminRole.ViewModels;
@model EditRoleMenuModel
<!DOCTYPE html>
<html>
<head>
    <title>修改角色菜单</title>
    <link href="@Url.Content("~/Content/themes/base/jquery-ui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tabs").tabs({
                ajaxOptions: {
                    error: function (xhr, status, index, anchor) {
                        $(anchor.hash).html("系统繁忙,请稍候再试");
                    }
                }
            });
        });
    </script>
</head>
<body>
    <div id="tabs">
        <ul>
            <li><a href="#editPowers">修改角色菜单</a></li>
        </ul>
        <div id="editPowers">
            @using (Html.BeginForm("EditRoleMenus"))
            {
                <table width="100%">
                    <tr>
                        <th colspan="4">
                            角色信息
                        </th>
                    </tr>
                    <tr>
                        <td style="width: 20%; text-align: right;">
                            角色编号
                        </td>
                        <td style="width: 30%">
                            @Html.TextBoxFor(m => m.RoleId, new { @readonly = "true" })
                        </td>
                        <td style="width: 20%; text-align: right;">
                            角色名称
                        </td>
                        <td style="width: 30%">
                            @Html.TextBoxFor(m => m.RoleName, new { @readonly = "true" })
                        </td>
                    </tr>
                </table>
                <div style="margin-top: 8px;">
                    <table width="100%">
                        <tr>
                            <th colspan="2">
                                角色菜单
                            </th>
                        </tr>
                        <tr>
                            <td>
                                @foreach (var item in Model.Menus.Select(m => m.ModulName).Distinct())
                                {
                                    <ul>
                                        <li><strong>@item</strong>
                                            <ul>
                                                @foreach (var menu in Model.Menus.Where(m => m.ModulName == item).Select(m => m))
                                                {
                                                    <li>
                                                        @Html.CheckBox("chk_" + menu.MenuId, menu.IsSelected)
                                                        @menu.MenuName
                                                    </li>
                                                }
                                            </ul>
                                        </li>
                                    </ul>
                                }
                            </td>
                        </tr>
                    </table>
                </div>
                <p>
                    <input type="submit" value="修改角色菜单" /></p>
            }
        </div>
    </div>
</body>
</html>
